
*Author: Joonas Tuhkuri
*Updated: March 5 2024
*Description: This do file prepares persons.dta (only adds a new person ID consistent with FOLK modules)

*Preliminaries
	clear all
	global project_root "W:\Ramin\Stereotypes revision"

*Prepare person id crosswalk
	use "W:\input2018\Tk_tutnro_crosswalk\Tk_tutnro_crosswalk.dta"
	rename Tk_tutnro_uusi id
	rename uusi_tutnro shnro 
	keep id shnro
	save "${project_root}\data_prep\xwalk_id_shnro.dta", replace
	
*Use fixed person data
	use "W:\data2018\persons.dta", clear // Reads person data from Jokela et al.
	keep if pluku != . /* restrict to pluku */
	keep if synvuosi >=1962
	keep if synvuosi <=1979
	
*Merge with person id crosswalk
	merge m:1 id using "${project_root}\data_prep\xwalk_id_shnro.dta"  // Note: imperfect match
	order id shnro _merge
	keep if _merge==3
	drop _merge
	
*Save
	save "W:\Ramin\Stereotypes revision\data_prep\persons.dta", replace
	